﻿namespace Syngine.Components
{
	/// <summary>
	/// 
	/// </summary>
	public abstract class CommandHandler : ICommandHandler
	{
		/// <summary>
		/// Handles the specified command.
		/// </summary>
		/// <param name="command">The command.</param>
		public abstract void Handle(ICommand command);
	}

	/// <summary>
	/// 
	/// </summary>
	public abstract class CommandHandler<TCommand> : CommandHandler, ICommandHandler<TCommand> where TCommand : ICommand
	{
		public abstract void Handle(TCommand command);

		/// <summary>
		/// Handles the specified command.
		/// </summary>
		/// <param name="command">The command.</param>
		public override void Handle(ICommand command)
		{
			if (command is TCommand)
			{
				Handle((TCommand)command);
			}
		}
	}
}